package com.leo.base_project.config;

import android.app.Application;
import android.content.Context;

import com.leo.base_project.activity.crash.CrashHandler;

/**
 * @program: BaseProject
 * @description: 全局application类
 * @author: Leo
 * @create: 2021-03-28 11:14
 **/
public class App extends Application {

    static Context context;

    @Override
    public void onCreate() {
        super.onCreate();
        context = getApplicationContext();
        setCrashHandler();
    }

    /* @Description: 设置全局异常捕获器
     * @Param:
     * @return:
     * @Author: Leo
     * @Date: 2021/3/28
     **/
    private void setCrashHandler() {
        CrashHandler handler = CrashHandler.getInstance();
        handler.init(getApplicationContext());
        handler.init(getApplicationContext());
        Thread.setDefaultUncaughtExceptionHandler(handler);
    }

    public static Context getAppContext(){
        return context;
    }


}
